package com.shop.loan.model;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.sub_erupt.Power;
import xyz.erupt.annotation.sub_field.Edit;
import xyz.erupt.annotation.sub_field.EditType;
import xyz.erupt.annotation.sub_field.View;
import xyz.erupt.annotation.sub_field.sub_edit.ChoiceType;
import xyz.erupt.annotation.sub_field.sub_edit.DateType;
import xyz.erupt.annotation.sub_field.sub_edit.VL;
import xyz.erupt.upms.model.base.HyperModel;

import javax.persistence.*;
import java.util.Date;

@Setter
@Getter
@Entity
@Table(name = "s_order_logistics")
@Erupt(
        name = "订单物流",
        power = @Power(add = false, delete = false),
        authVerify = false
)
@ApiModel("订单物流")
public class LoanOrderLogistics extends HyperModel {

//    @ManyToOne
//    @JoinColumn(name = "order_id")
//    private UserOrder userOrder;

    @Transient
    private String logisticsName;


    @Column(name = "order_id")
    private Long orderId;

    @EruptField(
            views = @View(title = "快递订单号"),
            edit = @Edit(title = "快递订单号", desc = "设置快递单号后订单状态将变更为待收货")
    )
    @ApiModelProperty(name = "number", value = "快递订单号", dataType = "string", example = "1")
    private String number;

    @EruptField(
            views = @View(title = "收件人名称"),
            edit = @Edit(title = "收件人名称")
    )
    @ApiModelProperty(name = "addressName", value = "收件人名称", dataType = "string", example = "1")
    private String addressName;

    @EruptField(
            views = @View(title = "收件人号码"),
            edit = @Edit(title = "收件人号码")
    )
    @ApiModelProperty(name = "addressPhone", value = "收件人号码", dataType = "string", example = "1")
    private String addressPhone;

    @EruptField(
            views = @View(title = "收件人地址"),
            edit = @Edit(title = "收件人地址")
    )
    @ApiModelProperty(name = "addressInfo", value = "收件人地址", dataType = "string", example = "1")
    private String addressInfo;

    @EruptField(
            edit = @Edit(
                    title = "快递类型",
                    type = EditType.CHOICE,
                    choiceType = @ChoiceType(
                            vl = {
                                    @VL(label = "顺丰", value = "shunfeng"),
                                    @VL(label = "中通", value = "zhongtong"),
                                    @VL(label = "圆通", value = "yuantong"),
                                    @VL(label = "百世", value = "huitongkuaidi"),
                                    @VL(label = "申通", value = "shentong"),
                                    @VL(label = "韵达", value = "yunda"),
                                    @VL(label = "ems", value = "ems"),
                                    @VL(label = "京东", value = "jd"),
                                    @VL(label = "德邦", value = "debangkuaidi"),
                                    @VL(label = "邮政", value = "youzhengguonei"),
                            }
                    ))
    )
    private String type;

    @EruptField(
            views = @View(title = "状态"),
            edit = @Edit(
                    title = "状态",
                    type = EditType.CHOICE,
                    choiceType = @ChoiceType(
                            vl = {
                                    @VL(label = "在途", value = "0"),
                                    @VL(label = "揽收", value = "1"),
                                    @VL(label = "疑难", value = "2"),
                                    @VL(label = "签收", value = "3"),
                                    @VL(label = "退签", value = "4"),
                                    @VL(label = "派件", value = "5"),
                                    @VL(label = "退回", value = "6"),
                                    @VL(label = "转投", value = "7"),
                                    @VL(label = "清关", value = "8"),
                                    @VL(label = "拒签", value = "14"),
                            }
                    ))
    )
    @ApiModelProperty(name = "status", value = "状态   " +
            "0：在途" +
            "1：揽收" +
            "2：疑难" +
            "3：签收" +
            "4：退签" +
            "5：派件" +
            "6：退回" +
            "7：转投" +
            "8：清关" +
            "14：拒签"
            , dataType = "string", example = "1")
    private Integer status;

    @Lob
    @EruptField(
            edit = @Edit(title = "物流信息", show = false)
    )
    @ApiModelProperty(name = "infoLog", value = "物流信息", dataType = "string", example = "1")
    private String infoLog;

    @EruptField(
            views = @View(title = "发货时间"),
            edit = @Edit(title = "时间", dateType = @DateType(type = DateType.Type.DATE_TIME))
    )

    private Date deliverTime;

    @EruptField(
            views = @View(title = "签收时间"),
            edit = @Edit(title = "时间", dateType = @DateType(type = DateType.Type.DATE_TIME))
    )
    private Date arriveConfirmTime;

}
